package com.geeklei.media.ui.menu;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.geeklei.media.ui.R;


public class MenuView extends RelativeLayout {
    private ImageView mIcon;
    private MenuItem mItem;
    private View mLine;
    private TextView mText;

    public MenuView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public MenuView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public MenuView(Context context) {
        super(context);
    }

    protected void onFinishInflate() {
        super.onFinishInflate();
        this.mIcon = (ImageView) findViewById(R.id.menu_icon);
        this.mText = (TextView) findViewById(R.id.menu_text);
        this.mLine = findViewById(R.id.menu_line);
    }

    public void setMenuItem(MenuItem menuItem) {
        this.mItem = menuItem;
        if (this.mItem != null) {
            this.mIcon.setImageResource(this.mItem.getIcon());
            this.mText.setText(this.mItem.getText());
        }
    }

    public MenuItem getMenuItem() {
        return this.mItem;
    }

    public void setLineVisible(boolean z) {
        this.mLine.setVisibility(z ? View.VISIBLE : View.GONE);
    }
}
